package com.fstec.ks.master.dao.jdbc.extractor;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.fstec.ks.master.vo.ExamRoundVO;

/**
 * 考试场次信息字段Extractor类
 * @Title ExamRoundExtractor.java
 * @Package com.fstec.ks.master.dao.jdbc.extractor
 * @Description 
 * Copyright: Copyright (c) 2017
 * Company:北京信诺软通
 *
 * @author <a href="mailto:zhkuqijin@163.com">谢启进</a>
 * @date 2023年10月06日 下午14:37:34
 * @version V1.0
 */
public class ExamRoundExtractor implements ResultSetExtractor<List<ExamRoundVO>> {
	/**
	 * 查询字段
	 * 
	 * @return
	 * @auth <a href="mailto:liyunfeng@sinotn.com">李云峰</a>
	 * @date 2017年3月6日 下午3:27:25
	 */
	public static String getColumns() {
		return "id,begin_time,end_time";
	}

	/*
	 * @see org.springframework.jdbc.core.ResultSetExtractor#extractData(java.sql.ResultSet)
	 */
	@Override
	public List<ExamRoundVO> extractData(ResultSet rs) throws SQLException, DataAccessException {
		ArrayList<ExamRoundVO> list = new ArrayList<ExamRoundVO>();
		ExamRoundVO vo = null;
		while(rs.next()) {
			vo = new ExamRoundVO();
			vo.setId(rs.getString(1));
			vo.setBeginTime(new Date(rs.getLong(2)));
			vo.setEndTime(new Date(rs.getLong(3)));
			list.add(vo);
		}
		return list;
	}
}
